<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="renderer" content="webkit">
  <title></title>
  <link rel="stylesheet" href="../css/pintuer.css">
  <link rel="stylesheet" href="../css/admin.css">
  <script src="../js/jquery.js"></script>
  <script src="../js/pintuer.js"></script>
  <script>
	  function addUser(){
		  var myData = $("#addUser").serialize();
		  $.ajax({
		  	type: "post",
		  	url: "http://localhost:8083/admin/addUser",
		  	async: true,
		  	data: myData,
		  	dataType: "json",
		  	success: function(result) {
				if(result == 1){
					alert("添加用户成功!");
					window.location.href = "adduser.html";
				}else{
					alert("添加失败");
					window.location.href = "adduser.html";
				}
			
		  	}
		  
		  });
	  }
  </script>
</head>

<body>
  <div class="panel admin-panel">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>新增用户</strong>
      <div style="float: right;" class="right fr">
        <a href="user.html" target="right">返回</a>
      </div>
    </div> 
    <div class="body-content">
      <form method="post" class="form-x"  id="addUser">
        <div class="form-group">
          <div class="label">
            <label>员工卡号：</label>
          </div>
          <div class="field">
            <input type="text" class="input w50" id="userId" value="" name="userId" data-validate="required:请输入员工卡号" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>员工姓名：</label>
          </div>
          <div class="field">
            <input type="text" class="input w50" id="userName" value="" name="userName" data-validate="required:请输入员工姓名" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>用户类型：</label>
          </div>
          <div class="field">
            <input type="text" class="input w50" value=""  id= "isAdmin" name="isAdmin" placeholder="1代表管理员,0代表普通用户" data-validate="required:请输入员工类型" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label></label>
          </div>
          <div class="field">
            <button class="button bg-main icon-check-square-o" type="button" onclick="addUser()"> 添加</button>
          </div>
        </div>
      </form>
    </div>
  </div>

</body>

</html>